package bobaini.com.controller;

import bobaini.com.service.AsyncService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: liuyi
 * ClassName: Test
 * Version: 1.0.0
 * DateTime: 2021/03/31-10:36:00
 * Description: TODO
 */
@RestController
@RequestMapping("/thread")
public class ThreadPoolController {

    private static final Logger logger = LoggerFactory.getLogger(ThreadPoolController.class);

    @Autowired
    private AsyncService asyncService;

    @RequestMapping("/test")
    public String submit() {
        logger.info("start submit"+Thread.currentThread().getName());

        //调用service层的任务
        asyncService.executeAsync();

        logger.info("end submit"+Thread.currentThread().getName());

        return "success";
    }
}

